<template>
    <el-row class="el-row">
        <el-col :span="6" :offset="6">
            <el-input placeholder="请输入数据" v-model="title"></el-input>
        </el-col>
        <el-col :span="3">
            <el-button type="success" @click="addItem">添加数据</el-button>
        </el-col>
    </el-row>
</template>

<script lang="ts">
import { defineComponent, ref } from "vue";

export default defineComponent({
    setup(props, { emit }) {
        const title = ref<string>("");
        console.log(title);
        const addItem = () => {
            emit("add", title.value);
            //添加完清空input框
            title.value = "";
        };
        return {
            title,
            addItem,
        };
    },
});
</script>

<style scoped>

</style>